#include "ogl/gut/RenderTarget.h"
#include "ogl/gut/Dictionary.h"
#include "imgui/custom/Editor.h"

using namespace Ogl::Gut;

template <>
bool ImGui::Editor::Edit(const std::string& label, Ogl::Gut::RenderTarget& inst)
{
    int index = 0;
    if (Editor::TreeNode(label.c_str(), inst.m_BitFlag, index++))
    {

        EditInst<Ogl::Gut::RenderTargetDesc>("Desc", inst.m_Desc);
        if (TreeNode("Textures", inst.m_BitFlag, index++))
        {
            for (int i = 0; i < inst.m_Textures.size(); i++)
            {
                auto& tex = inst.m_Textures[i];
                EditInst<Ogl::Gut::Texture2D>(std::string("texture") + std::to_string(i), *tex);
            };

            ImGui::TreePop();
        }

        EditInst<FrameBuffer>("FrameBuffer", inst.m_FrameBuffer);
        EditInst<RenderBuffer>("RenderBuffer", inst.m_RenderBuffer);

        ImGui::TreePop();
    }

    return false;
}
